home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d17 / psend.arc / PSEND.DOC < prev    next >
Text File  |  1987-09-29  |  5KB  |  139 lines

  1. Docs for PSEND.COM and PTEST.COM - send printer codes from ascii files
  2. R. Trevithick, 09/29/87
  3.  
  4.  
  5. PSEND.COM
  6. =========
  7.  
  8. This is a simple little utility which reads printer control codes from an
  9. ascii text file and sends them to the default printer.
  10.  
  11. The syntax is:
  12.  
  13.         PSEND [d:][path]filename.ext
  14.  
  15.  
  16. The program aborts on any error, including printer not ready, and returns
  17. immediately to DOS with errorlevel 1 set.  It produces no messages on
  18. screen.  The idea was to keep it small and fast.
  19.  
  20. The ascii text files are created with a text editor (in pure ascii mode) or
  21. with the DOS 'copy con' command.
  22.  
  23. The codes must be entered as base 10 numeric values in the range of 0..255,
  24. and must be surrounded by brackets <>.  Brackets cannot appear in the file
  25. EXCEPT when surrounding the codes.
  26.  
  27. There are no other formatting requirements beyond the fact that the file
  28. cannot be larger than 32766 bytes.  Hence, you can put comments and so on
  29. in the files to remind you what the codes do.
  30.  
  31. Example:
  32.  
  33. To send an escape, followed by an uppercase 'A' and a zero byte:
  34.  
  35.         <27><65><0>
  36.  
  37. To send a formfeed:
  38.  
  39.         <13><10><12>
  40.  
  41. Note that many printers won't process the formfeed character <12> unless
  42. it's paired with a carriage return <13> and linefeed <10> sequence.
  43.  
  44.  
  45. An example of a typical batch file to send some printer codes and run an
  46. application:
  47.  
  48.         psend custom.prn
  49.         if errorlevel 1 goto ABORT
  50.         dbase myprog
  51.         goto END
  52.         :ABORT
  53.         echo ---ERROR --- printer setup failed!
  54.         :END
  55.  
  56. This would attempt to send the codes contained in the file 'custom.prn' to
  57. the printer.  If there were any errors, we'd skip the program and go to the
  58. abort message.  If the setup succeeded, dBase would be run with the
  59. argument 'myprog'.
  60.  
  61.  
  62.  
  63. PTEST.COM
  64. =========
  65.  
  66. PTEST is a program to assist in debugging the code files you'll be using
  67. with PSEND.  It's run with the same syntax, and differs only in that it
  68. displays diagnostic messages when run.
  69.  
  70. The PTEST program will display the codes on the screen, flagging any which
  71. contain errors, and send the valid ones out to the printer.  If the printer
  72. isn't ready, the codes will just be displayed on the screen, and you'll get
  73. a message about the printer not accepting characters.
  74.  
  75. Assuming the printer was on-line, you could then send some text to it to
  76. find out what effect your codes had.  For example, to test the file
  77. 'test.prn':
  78.  
  79.         PTEST test.prn
  80.  
  81.  
  82. Any invalid codes will appear as '<L>' or '<V>', to avoid dumping
  83. screenloads of garbage to the display in certain types of error situations.
  84. The <L>ength message means you have either less than 1 or more than 3
  85. characters inside a set of brackets.  The <V>alue message means you either
  86. have a non-numeric character or a number which cannot fit into a single
  87. byte (the 0..255 8-bit ascii range).
  88.  
  89.  
  90. For example, if your printer code file had this in it:
  91.  
  92.         <13><10><999><30><X><20><1234><12><5H>
  93.  
  94. you would see this when you ran PTEST against it:
  95.  
  96.         13 10 999-<V> 30 <V> 20 123-<L> 12 5-<V>
  97.          errors found in codes!
  98.  
  99.  
  100. The program displays the codes as it finds them, from left to right.  It
  101. continues displaying each character of a given code until it hits the
  102. end-of-code character '>' or until it detects any error condition.
  103.  
  104. In the above example, the 13, 10, 30, 20 and 12 values display normally, as
  105. they should.  The '999' is comprised of valid characters, so they are
  106. shown.  When PTEST converts this set of characters to a numeric byte value
  107. in preparation for sending it to the printer, however, an overflow occurs,
  108. so it tags the <V>alue error message onto the end of the displayed code.
  109.  
  110. The 'X' character is immediately recognized as invalid, so it is simply
  111. thrown away and again the <V>alue error is displayed.  The fact that it
  112. isn't connected with a dash to the previous code tells you that it
  113. represents a code which wasn't displayable at all.  The '1234' code is ok
  114. through the 3rd character, but when the 4th is hit PTEST tags it as a
  115. <L>ength error (too many characters).  The last code is ok in the 1st
  116. position, so the '5' is shown.  The illegal 'H' character, however, causes
  117. a <V>alue error to occur.
  118.  
  119. There are a couple of points worth noting about all of this.  The first is
  120. that ONLY valid characters are displayed by PTEST.  It stops processing a
  121. code as soon as it hits any kind of error.  If the error is in the 1st
  122. character position, there isn't anything to display.
  123.  
  124. The second point you should note is the use of the dashes.  When part of a
  125. code has been displayed, any error that occurs will be shown as connected,
  126. with a dash, to the code being processed.  If the code is found to be
  127. invalid in the very first character and can't be displayed at all, the
  128. error message will appear alone without the dash.
  129.  
  130.  
  131. Bob Trevithick                          GEnie address:  R.TREVITHICK
  132. Information Services Department
  133. Newark DDSO
  134. 703 E. Maple Ave
  135. Newark, NY  14513
  136.  
  137. Voice:   (315) 331-1700
  138.  
  139.